using log4net;
using log4net.Config;
using SilverSea.Databases;
using SilverSea.Registration;
using SilverSea.Untilities;
using SilverSea.Video.Tools;
using System;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.Xml;
public sealed class SystemConfiguration
{
	private delegate void Delegate0(Control control_0, string string_0, object object_0);
	private sealed class Class1
	{
		public ExtendCollection2 ExtendCollection2_0;
		public int int_0;
		public int int_1;
		public int int_2;
		public void method_0(int int_3)
		{
			for (int i = 0; i < this.int_2; i++)
			{
				System.Drawing.Color color = this.ExtendCollection2_0.method_1(int_3, i);
				this.int_0 += (int)color.R;
				this.int_1++;
			}
		}
	}
	public IConnection iconnection_0;
    public BO4List ExtendCollection0_0 = new BO4List();
    public BO3List gclass8_0 = new BO3List();
	public BO2List gclass6_0 = new BO2List();
    public BO1List gclass4_0 = new BO1List();
	private string m_LaneConfig = Application.StartupPath + "\\fileConfig\\lane.config";
	private string m_SettingConfig = Application.StartupPath + "\\fileConfig\\setting.config";
	private static string m_DatabaseConfig = Application.StartupPath + "\\fileConfig\\database.config";
	public Camera camera_0 = new Camera();
	public Camera ZoomCamera = new Camera();
	public Camera RedLightCamera = new Camera();
	public Camera ViewCamera = new Camera();
	public System.Drawing.Rectangle rectangle_0 = new System.Drawing.Rectangle(0, 0, 10, 10);
	public System.Drawing.Rectangle rectangle_1 = new System.Drawing.Rectangle(0, 0, 10, 10);
	public System.Drawing.Rectangle rectangle_2 = new System.Drawing.Rectangle(0, 0, 10, 10);
    public GeneralParameters gclass3_0 = new GeneralParameters();
    public GeneralParameters gclass3_1 = new GeneralParameters();
    public GeneralParameters gclass3_2 = new GeneralParameters();
    public GeneralParameters gclass3_3 = new GeneralParameters();
	public int int_0 = 40;
	public int int_1 = 40;
	public bool bool_0;
	public bool bool_1;
	public int int_2;
	public int int_3 = 30;
	public int int_4 = 1000;
	public int int_5 = 15;
	public int int_6 = 15;
	public int int_7 = 15;
	public int int_8 = 10000;
	public System.DateTime dateTime_0 = System.DateTime.Now;
	public System.DateTime dateTime_1 = System.DateTime.Now;
	public int int_9 = 1;
	public int int_10 = 2;
	public bool bool_2 = true;
	public string m_ImgPath = Application.StartupPath + "\\img";
	public int int_11;
	public int int_12 = 1;
	public int int_13 = 8;
	public int int_14 = 100;
	public string string_4 = "VN";
	public string string_5 = string.Empty;
	public string string_6 = "68";
	public int int_15 = 100;
	public bool bool_3;
	public int int_16 = 2;
	public int int_17 = 50;
	public int int_18 = 10;
	public int int_19 = 768;
	public int int_20 = 1024;
	public bool bool_4;
	public string m_Title = "HỆ THỐNG PHÁT HIỆN VI PHẠM VƯỢT ĐÈN ĐỎ";
	public string string_8 = string.Empty;
	public bool bool_5;
	public int int_21 = 10;
	public bool bool_6 = true;
	public string string_9 = "admin";
	public string string_10 = "12345";
	public string string_11 = "DAI LO BINH DUONG";
	public string string_12 = "THU DAU MOT - BINH DUONG";
	public string string_13 = "VƯỢT ĐÈN ĐỎ";
	public string string_14 = "Phòng CSGT Đường bộ - CA Tỉnh BINH DUONG";
	public string string_15 = System.Drawing.KnownColor.Control.ToString();
	public static int m_DbType = 0;
	public static string m_ServerName = "Microsoft.Jet.OLEDB.4.0";
	public static string m_DatabaseName = Application.StartupPath + "\\RedLightViolation.mdb";
    public static int m_Authentication = 0;
    public static string m_UserName = string.Empty;
    public static string m_Password = "spthai";
    public static bool m_EnableMARS = false;
    public readonly BO5List ExtendCollection_0 = new BO5List();
	private static ILog ilog_0 = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
	public int int_24;
	public int int_25;
	public SystemConfiguration()
	{
		BasicConfigurator.Configure();
		XmlConfigurator.Configure();
		if (SystemConfiguration.m_DbType == 0)
		{
			this.iconnection_0 = new SqlServerConnection();
		}
		else
		{
			this.iconnection_0 = new AccessConnection();
		}
		this.iconnection_0.ServerName = SystemConfiguration.m_ServerName;
		this.iconnection_0.DatabaseName = SystemConfiguration.m_DatabaseName;
		this.iconnection_0.Authentication = SystemConfiguration.m_Authentication;
		this.iconnection_0.UserName = SystemConfiguration.m_UserName;
		this.iconnection_0.Password = SystemConfiguration.m_Password;
		this.iconnection_0.EnableMARS = SystemConfiguration.m_EnableMARS;
		this.iconnection_0.DatabaseConnectionErrorEvent += new DatabaseConnectionErrorEventHandler(this.iconnection_0_DatabaseConnectionErrorEvent);
		this.iconnection_0.Open();
	}
	private void iconnection_0_DatabaseConnectionErrorEvent(string string_20)
	{
		SystemConfiguration.ilog_0.Error(string_20);
	}
	public void method_0(string string_20, ref int int_26)
	{
		try
		{
			int_26 = 1;
			if (string_20.IndexOf("-") != 3)
			{
				if (string_20.IndexOf("-") != 4)
				{
					if (string_20.IndexOf("-") != 2)
					{
						goto IL_73;
					}
					if (string_20.Length != 10)
					{
						if (string_20.Length != 11)
						{
							if (string_20.Length == 8 || string_20.Length == 12)
							{
								int_26 = 2;
								goto IL_73;
							}
							goto IL_73;
						}
					}
					if (char.IsDigit(string_20, 4))
					{
						int_26 = 1;
						goto IL_73;
					}
					int_26 = 0;
					goto IL_73;
				}
			}
			int_26 = 2;
			IL_73:;
		}
		catch (System.Exception ex)
		{
			SystemConfiguration.ilog_0.Error(ex);
		}
	}
	public bool method_1(System.Drawing.Bitmap bitmap_0, string string_20)
	{
		try
		{
			if (bitmap_0 != null && string_20 != string.Empty)
			{
				bitmap_0.Save(string_20, System.Drawing.Imaging.ImageFormat.Jpeg);
				return true;
			}
		}
		catch (System.Exception ex)
		{
			SystemConfiguration.ilog_0.Error(ex);
		}
		finally
		{
			bitmap_0.Dispose();
		}
		return false;
	}
	public void method_2(string string_20)
	{
		try
		{
			if (string_20 != string.Empty)
			{
				System.IO.File.Delete(string_20);
			}
		}
		catch (System.Exception ex)
		{
			SystemConfiguration.ilog_0.Error(ex);
		}
	}
	public string method_3()
	{
		try
		{
			string text = this.m_ImgPath;
			if (this.method_4(text))
			{
				string text2 = text;
				text = string.Concat(new string[]
				{
					text2,
					"\\Thang_",
					System.DateTime.Now.Month.ToString(),
					"_",
					System.DateTime.Now.Year.ToString(),
					"\\",
					System.DateTime.Now.ToString("yyyy_MM_dd")
				});
				if (this.method_4(text))
				{
					string result = text;
					return result;
				}
			}
			else
			{
				text = Application.StartupPath + "\\img\\" + System.DateTime.Now.ToString("yyyy_MM_dd");
				if (this.method_4(text))
				{
					text += "\\imgs";
					if (this.method_4(text))
					{
						string result = text;
						return result;
					}
				}
			}
		}
		catch (System.Exception ex)
		{
			SystemConfiguration.ilog_0.Error(ex);
		}
		return string.Empty;
	}
	private bool method_4(string string_20)
	{
		try
		{
			if (!System.IO.Directory.Exists(string_20))
			{
				System.IO.Directory.CreateDirectory(string_20);
			}
			return true;
		}
		catch (System.Exception ex)
		{
			SystemConfiguration.ilog_0.Error(ex);
		}
		return false;
	}
	public void method_5()
	{
		if (System.IO.File.Exists(this.m_LaneConfig))
		{
			XmlTextReader xmlTextReader = null;
			try
			{
				try
				{
					System.IO.FileStream input = new System.IO.FileStream(this.m_LaneConfig, System.IO.FileMode.Open);
					xmlTextReader = new XmlTextReader(input);
					xmlTextReader.WhitespaceHandling = WhitespaceHandling.None;
					xmlTextReader.MoveToContent();
					if (xmlTextReader.Name != "configuration")
					{
						SystemConfiguration.ilog_0.Error("Can not find configuration node");
						throw new System.ApplicationException("Can not find configuration node");
					}
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "VehicleCamera1")
					{
						throw new System.ApplicationException("can not find vehicle camera 1 node");
					}
					this.camera_0.ID = System.Convert.ToInt32(xmlTextReader.GetAttribute("id"));
					this.camera_0.Name = xmlTextReader.GetAttribute("name");
					this.camera_0.VideoSource = xmlTextReader.GetAttribute("videoSource");
					this.camera_0.Chanel = System.Convert.ToInt32(xmlTextReader.GetAttribute("chanel"));
					this.camera_0.Login = xmlTextReader.GetAttribute("login");
					this.camera_0.Password = xmlTextReader.GetAttribute("password");
					this.camera_0.CameraType = CameraTypes.GetType(xmlTextReader.GetAttribute("cameraType"));
					this.camera_0.StreamType = StreamTypes.GetType(xmlTextReader.GetAttribute("streamType"));
					this.camera_0.Resolution = xmlTextReader.GetAttribute("resolution");
					this.camera_0.Quality = xmlTextReader.GetAttribute("quality");
					this.camera_0.FrameRate = System.Convert.ToInt32(xmlTextReader.GetAttribute("frameRate"));
					this.camera_0.EnableMotionDetection = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableMotionDetection"));
					this.camera_0.MotionAlarmLevel = System.Convert.ToInt32(xmlTextReader.GetAttribute("motionAlarmLevel"));
					this.camera_0.MotionRegions = xmlTextReader.GetAttribute("motionRegions");
					this.camera_0.DisplayMotionRegion = System.Convert.ToBoolean(xmlTextReader.GetAttribute("displayMotionRegion"));
					this.camera_0.SuppressNoise = System.Convert.ToBoolean(xmlTextReader.GetAttribute("suppressNoise"));
					this.camera_0.MotionDetectionInterval = System.Convert.ToInt32(xmlTextReader.GetAttribute("motionDetectionInterval"));
					this.camera_0.UsingDeinterlaceFilter = System.Convert.ToBoolean(xmlTextReader.GetAttribute("usingDeinterlaceFilter"));
					this.camera_0.DeinterlaceFilterName = xmlTextReader.GetAttribute("deinterlaceFilterName");
					this.camera_0.EnableAUXControl = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableAUXControl"));
					this.camera_0.UsingPlugins = System.Convert.ToInt32(xmlTextReader.GetAttribute("usingPlugins"));
					this.camera_0.Description = xmlTextReader.GetAttribute("description");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "VehicleCamera2")
					{
						throw new System.ApplicationException("can not find vehicle camera 2 node");
					}
                    this.ZoomCamera.ID = System.Convert.ToInt32(xmlTextReader.GetAttribute("id"));
                    this.ZoomCamera.Name = xmlTextReader.GetAttribute("name");
                    this.ZoomCamera.VideoSource = xmlTextReader.GetAttribute("videoSource");
                    this.ZoomCamera.Chanel = System.Convert.ToInt32(xmlTextReader.GetAttribute("chanel"));
                    this.ZoomCamera.Login = xmlTextReader.GetAttribute("login");
                    this.ZoomCamera.Password = xmlTextReader.GetAttribute("password");
                    this.ZoomCamera.CameraType = CameraTypes.GetType(xmlTextReader.GetAttribute("cameraType"));
                    this.ZoomCamera.StreamType = StreamTypes.GetType(xmlTextReader.GetAttribute("streamType"));
                    this.ZoomCamera.Resolution = xmlTextReader.GetAttribute("resolution");
                    this.ZoomCamera.Quality = xmlTextReader.GetAttribute("quality");
                    this.ZoomCamera.FrameRate = System.Convert.ToInt32(xmlTextReader.GetAttribute("frameRate"));
                    this.ZoomCamera.EnableMotionDetection = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableMotionDetection"));
                    this.ZoomCamera.MotionAlarmLevel = System.Convert.ToInt32(xmlTextReader.GetAttribute("motionAlarmLevel"));
                    this.ZoomCamera.MotionRegions = xmlTextReader.GetAttribute("motionRegions");
                    this.ZoomCamera.DisplayMotionRegion = System.Convert.ToBoolean(xmlTextReader.GetAttribute("displayMotionRegion"));
                    this.ZoomCamera.SuppressNoise = System.Convert.ToBoolean(xmlTextReader.GetAttribute("suppressNoise"));
                    this.ZoomCamera.MotionDetectionInterval = System.Convert.ToInt32(xmlTextReader.GetAttribute("motionDetectionInterval"));
                    this.ZoomCamera.UsingDeinterlaceFilter = System.Convert.ToBoolean(xmlTextReader.GetAttribute("usingDeinterlaceFilter"));
                    this.ZoomCamera.DeinterlaceFilterName = xmlTextReader.GetAttribute("deinterlaceFilterName");
                    this.ZoomCamera.EnableAUXControl = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableAUXControl"));
                    this.ZoomCamera.UsingPlugins = System.Convert.ToInt32(xmlTextReader.GetAttribute("usingPlugins"));
                    this.ZoomCamera.Description = xmlTextReader.GetAttribute("description");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "RedLightCamera")
					{
						throw new System.ApplicationException("can not find red light camera node");
					}
                    this.RedLightCamera.ID = System.Convert.ToInt32(xmlTextReader.GetAttribute("id"));
                    this.RedLightCamera.Name = xmlTextReader.GetAttribute("name");
                    this.RedLightCamera.VideoSource = xmlTextReader.GetAttribute("videoSource");
                    this.RedLightCamera.Chanel = System.Convert.ToInt32(xmlTextReader.GetAttribute("chanel"));
                    this.RedLightCamera.Login = xmlTextReader.GetAttribute("login");
                    this.RedLightCamera.Password = xmlTextReader.GetAttribute("password");
                    this.RedLightCamera.CameraType = CameraTypes.GetType(xmlTextReader.GetAttribute("cameraType"));
                    this.RedLightCamera.StreamType = StreamTypes.GetType(xmlTextReader.GetAttribute("streamType"));
                    this.RedLightCamera.Resolution = xmlTextReader.GetAttribute("resolution");
                    this.RedLightCamera.Quality = xmlTextReader.GetAttribute("quality");
                    this.RedLightCamera.FrameRate = System.Convert.ToInt32(xmlTextReader.GetAttribute("frameRate"));
                    this.RedLightCamera.EnableMotionDetection = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableMotionDetection"));
                    this.RedLightCamera.MotionAlarmLevel = System.Convert.ToInt32(xmlTextReader.GetAttribute("motionAlarmLevel"));
                    this.RedLightCamera.MotionRegions = xmlTextReader.GetAttribute("motionRegions");
                    this.RedLightCamera.DisplayMotionRegion = System.Convert.ToBoolean(xmlTextReader.GetAttribute("displayMotionRegion"));
                    this.RedLightCamera.SuppressNoise = System.Convert.ToBoolean(xmlTextReader.GetAttribute("suppressNoise"));
                    this.RedLightCamera.MotionDetectionInterval = System.Convert.ToInt32(xmlTextReader.GetAttribute("motionDetectionInterval"));
                    this.RedLightCamera.UsingDeinterlaceFilter = System.Convert.ToBoolean(xmlTextReader.GetAttribute("usingDeinterlaceFilter"));
                    this.RedLightCamera.DeinterlaceFilterName = xmlTextReader.GetAttribute("deinterlaceFilterName");
                    this.RedLightCamera.EnableAUXControl = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableAUXControl"));
                    this.RedLightCamera.UsingPlugins = System.Convert.ToInt32(xmlTextReader.GetAttribute("usingPlugins"));
                    this.RedLightCamera.Description = xmlTextReader.GetAttribute("description");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "PanoramaCamera")
					{
						throw new System.ApplicationException("can not find panorama camera node");
					}
                    this.ViewCamera.ID = System.Convert.ToInt32(xmlTextReader.GetAttribute("id"));
                    this.ViewCamera.Name = xmlTextReader.GetAttribute("name");
                    this.ViewCamera.VideoSource = xmlTextReader.GetAttribute("videoSource");
                    this.ViewCamera.Chanel = System.Convert.ToInt32(xmlTextReader.GetAttribute("chanel"));
                    this.ViewCamera.Login = xmlTextReader.GetAttribute("login");
                    this.ViewCamera.Password = xmlTextReader.GetAttribute("password");
                    this.ViewCamera.CameraType = CameraTypes.GetType(xmlTextReader.GetAttribute("cameraType"));
                    this.ViewCamera.StreamType = StreamTypes.GetType(xmlTextReader.GetAttribute("streamType"));
                    this.ViewCamera.Resolution = xmlTextReader.GetAttribute("resolution");
                    this.ViewCamera.Quality = xmlTextReader.GetAttribute("quality");
                    this.ViewCamera.FrameRate = System.Convert.ToInt32(xmlTextReader.GetAttribute("frameRate"));
                    this.ViewCamera.EnableMotionDetection = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableMotionDetection"));
                    this.ViewCamera.MotionAlarmLevel = System.Convert.ToInt32(xmlTextReader.GetAttribute("motionAlarmLevel"));
                    this.ViewCamera.MotionRegions = xmlTextReader.GetAttribute("motionRegions");
                    this.ViewCamera.DisplayMotionRegion = System.Convert.ToBoolean(xmlTextReader.GetAttribute("displayMotionRegion"));
                    this.ViewCamera.SuppressNoise = System.Convert.ToBoolean(xmlTextReader.GetAttribute("suppressNoise"));
                    this.ViewCamera.MotionDetectionInterval = System.Convert.ToInt32(xmlTextReader.GetAttribute("motionDetectionInterval"));
                    this.ViewCamera.UsingDeinterlaceFilter = System.Convert.ToBoolean(xmlTextReader.GetAttribute("usingDeinterlaceFilter"));
                    this.ViewCamera.DeinterlaceFilterName = xmlTextReader.GetAttribute("deinterlaceFilterName");
                    this.ViewCamera.EnableAUXControl = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableAUXControl"));
                    this.ViewCamera.UsingPlugins = System.Convert.ToInt32(xmlTextReader.GetAttribute("usingPlugins"));
                    this.ViewCamera.Description = xmlTextReader.GetAttribute("description");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Error while reading config file: " + ex.ToString());
					SystemConfiguration.ilog_0.Error(ex);
				}
				return;
			}
			finally
			{
				if (xmlTextReader != null)
				{
					xmlTextReader.Close();
				}
			}
		}
		MessageBox.Show("Không tìm thấy file cấu hình hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
		SystemConfiguration.ilog_0.Error("The config file can not found.");
	}
	public void method_6()
	{
		try
		{
			System.IO.FileStream w = new System.IO.FileStream(this.m_LaneConfig, System.IO.FileMode.Create);
			XmlTextWriter xmlTextWriter = new XmlTextWriter(w, System.Text.Encoding.UTF8);
			xmlTextWriter.Formatting = Formatting.Indented;
			xmlTextWriter.WriteStartDocument();
			xmlTextWriter.WriteStartElement("configuration");
			xmlTextWriter.WriteStartElement("VehicleCamera1");
			xmlTextWriter.WriteAttributeString("id", this.camera_0.ID.ToString());
			xmlTextWriter.WriteAttributeString("name", this.camera_0.Name);
            xmlTextWriter.WriteAttributeString("videoSource", this.camera_0.VideoSource);
			xmlTextWriter.WriteAttributeString("chanel", this.camera_0.Chanel.ToString());
            xmlTextWriter.WriteAttributeString("login", this.camera_0.Login);
            xmlTextWriter.WriteAttributeString("password", this.camera_0.Password);
			xmlTextWriter.WriteAttributeString("cameraType", this.camera_0.CameraType.ToString());
			xmlTextWriter.WriteAttributeString("streamType", this.camera_0.StreamType.ToString());
            xmlTextWriter.WriteAttributeString("resolution", this.camera_0.Resolution);
			xmlTextWriter.WriteAttributeString("quality", this.camera_0.Quality);
			xmlTextWriter.WriteAttributeString("frameRate", this.camera_0.FrameRate.ToString());
			xmlTextWriter.WriteAttributeString("enableMotionDetection", this.camera_0.EnableMotionDetection.ToString());
			xmlTextWriter.WriteAttributeString("motionAlarmLevel", this.camera_0.MotionAlarmLevel.ToString());
			xmlTextWriter.WriteAttributeString("motionRegions", this.camera_0.MotionRegions.ToString());
			xmlTextWriter.WriteAttributeString("displayMotionRegion", this.camera_0.DisplayMotionRegion.ToString());
			xmlTextWriter.WriteAttributeString("suppressNoise", this.camera_0.SuppressNoise.ToString());
			xmlTextWriter.WriteAttributeString("motionDetectionInterval", this.camera_0.MotionDetectionInterval.ToString());
			xmlTextWriter.WriteAttributeString("usingDeinterlaceFilter", this.camera_0.UsingDeinterlaceFilter.ToString());
			xmlTextWriter.WriteAttributeString("deinterlaceFilterName", this.camera_0.DeinterlaceFilterName.ToString());
			xmlTextWriter.WriteAttributeString("enableAUXControl", this.camera_0.EnableAUXControl.ToString());
			xmlTextWriter.WriteAttributeString("usingPlugins", this.camera_0.UsingPlugins.ToString());
            xmlTextWriter.WriteAttributeString("description", this.camera_0.Description);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("VehicleCamera2");
			xmlTextWriter.WriteAttributeString("id", this.ZoomCamera.ID.ToString());
			xmlTextWriter.WriteAttributeString("name", this.ZoomCamera.Name);
			xmlTextWriter.WriteAttributeString("videoSource", this.ZoomCamera.VideoSource);
			xmlTextWriter.WriteAttributeString("chanel", this.ZoomCamera.Chanel.ToString());
			xmlTextWriter.WriteAttributeString("login", this.ZoomCamera.Login);
			xmlTextWriter.WriteAttributeString("password", this.ZoomCamera.Password);
			xmlTextWriter.WriteAttributeString("cameraType", this.ZoomCamera.CameraType.ToString());
			xmlTextWriter.WriteAttributeString("streamType", this.ZoomCamera.StreamType.ToString());
			xmlTextWriter.WriteAttributeString("resolution", this.ZoomCamera.Resolution);
			xmlTextWriter.WriteAttributeString("quality", this.ZoomCamera.Quality);
			xmlTextWriter.WriteAttributeString("frameRate", this.ZoomCamera.FrameRate.ToString());
			xmlTextWriter.WriteAttributeString("enableMotionDetection", this.ZoomCamera.EnableMotionDetection.ToString());
			xmlTextWriter.WriteAttributeString("motionAlarmLevel", this.ZoomCamera.MotionAlarmLevel.ToString());
			xmlTextWriter.WriteAttributeString("motionRegions", this.ZoomCamera.MotionRegions.ToString());
			xmlTextWriter.WriteAttributeString("displayMotionRegion", this.ZoomCamera.DisplayMotionRegion.ToString());
			xmlTextWriter.WriteAttributeString("suppressNoise", this.ZoomCamera.SuppressNoise.ToString());
			xmlTextWriter.WriteAttributeString("motionDetectionInterval", this.ZoomCamera.MotionDetectionInterval.ToString());
			xmlTextWriter.WriteAttributeString("usingDeinterlaceFilter", this.ZoomCamera.UsingDeinterlaceFilter.ToString());
			xmlTextWriter.WriteAttributeString("deinterlaceFilterName", this.ZoomCamera.DeinterlaceFilterName.ToString());
			xmlTextWriter.WriteAttributeString("enableAUXControl", this.ZoomCamera.EnableAUXControl.ToString());
			xmlTextWriter.WriteAttributeString("usingPlugins", this.ZoomCamera.UsingPlugins.ToString());
			xmlTextWriter.WriteAttributeString("description", this.ZoomCamera.Description);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("RedLightCamera");
			xmlTextWriter.WriteAttributeString("id", this.RedLightCamera.ID.ToString());
			xmlTextWriter.WriteAttributeString("name", this.RedLightCamera.Name);
			xmlTextWriter.WriteAttributeString("videoSource", this.RedLightCamera.VideoSource);
			xmlTextWriter.WriteAttributeString("chanel", this.RedLightCamera.Chanel.ToString());
			xmlTextWriter.WriteAttributeString("login", this.RedLightCamera.Login);
			xmlTextWriter.WriteAttributeString("password", this.RedLightCamera.Password);
			xmlTextWriter.WriteAttributeString("cameraType", this.RedLightCamera.CameraType.ToString());
			xmlTextWriter.WriteAttributeString("streamType", this.RedLightCamera.StreamType.ToString());
			xmlTextWriter.WriteAttributeString("resolution", this.RedLightCamera.Resolution);
			xmlTextWriter.WriteAttributeString("quality", this.RedLightCamera.Quality);
			xmlTextWriter.WriteAttributeString("frameRate", this.RedLightCamera.FrameRate.ToString());
			xmlTextWriter.WriteAttributeString("enableMotionDetection", this.RedLightCamera.EnableMotionDetection.ToString());
			xmlTextWriter.WriteAttributeString("motionAlarmLevel", this.RedLightCamera.MotionAlarmLevel.ToString());
			xmlTextWriter.WriteAttributeString("motionRegions", this.RedLightCamera.MotionRegions.ToString());
			xmlTextWriter.WriteAttributeString("displayMotionRegion", this.RedLightCamera.DisplayMotionRegion.ToString());
			xmlTextWriter.WriteAttributeString("suppressNoise", this.RedLightCamera.SuppressNoise.ToString());
			xmlTextWriter.WriteAttributeString("motionDetectionInterval", this.RedLightCamera.MotionDetectionInterval.ToString());
			xmlTextWriter.WriteAttributeString("usingDeinterlaceFilter", this.RedLightCamera.UsingDeinterlaceFilter.ToString());
			xmlTextWriter.WriteAttributeString("deinterlaceFilterName", this.RedLightCamera.DeinterlaceFilterName.ToString());
			xmlTextWriter.WriteAttributeString("enableAUXControl", this.RedLightCamera.EnableAUXControl.ToString());
			xmlTextWriter.WriteAttributeString("usingPlugins", this.RedLightCamera.UsingPlugins.ToString());
			xmlTextWriter.WriteAttributeString("description", this.RedLightCamera.Description);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("PanoramaCamera");
			xmlTextWriter.WriteAttributeString("id", this.ViewCamera.ID.ToString());
			xmlTextWriter.WriteAttributeString("name", this.ViewCamera.Name);
			xmlTextWriter.WriteAttributeString("videoSource", this.ViewCamera.VideoSource);
			xmlTextWriter.WriteAttributeString("chanel", this.ViewCamera.Chanel.ToString());
			xmlTextWriter.WriteAttributeString("login", this.ViewCamera.Login);
			xmlTextWriter.WriteAttributeString("password", this.ViewCamera.Password);
			xmlTextWriter.WriteAttributeString("cameraType", this.ViewCamera.CameraType.ToString());
			xmlTextWriter.WriteAttributeString("streamType", this.ViewCamera.StreamType.ToString());
			xmlTextWriter.WriteAttributeString("resolution", this.ViewCamera.Resolution);
			xmlTextWriter.WriteAttributeString("quality", this.ViewCamera.Quality);
			xmlTextWriter.WriteAttributeString("frameRate", this.ViewCamera.FrameRate.ToString());
			xmlTextWriter.WriteAttributeString("enableMotionDetection", this.ViewCamera.EnableMotionDetection.ToString());
			xmlTextWriter.WriteAttributeString("motionAlarmLevel", this.ViewCamera.MotionAlarmLevel.ToString());
			xmlTextWriter.WriteAttributeString("motionRegions", this.ViewCamera.MotionRegions.ToString());
			xmlTextWriter.WriteAttributeString("displayMotionRegion", this.ViewCamera.DisplayMotionRegion.ToString());
			xmlTextWriter.WriteAttributeString("suppressNoise", this.ViewCamera.SuppressNoise.ToString());
			xmlTextWriter.WriteAttributeString("motionDetectionInterval", this.ViewCamera.MotionDetectionInterval.ToString());
			xmlTextWriter.WriteAttributeString("usingDeinterlaceFilter", this.ViewCamera.UsingDeinterlaceFilter.ToString());
			xmlTextWriter.WriteAttributeString("deinterlaceFilterName", this.ViewCamera.DeinterlaceFilterName.ToString());
			xmlTextWriter.WriteAttributeString("enableAUXControl", this.ViewCamera.EnableAUXControl.ToString());
			xmlTextWriter.WriteAttributeString("usingPlugins", this.ViewCamera.UsingPlugins.ToString());
			xmlTextWriter.WriteAttributeString("description", this.ViewCamera.Description);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.Close();
		}
		catch (System.Exception ex)
		{
			MessageBox.Show(ex.ToString());
			SystemConfiguration.ilog_0.Error(ex);
		}
	}
	public void method_7()
	{
		if (System.IO.File.Exists(this.m_SettingConfig))
		{
			XmlTextReader xmlTextReader = null;
			try
			{
				try
				{
					System.IO.FileStream input = new System.IO.FileStream(this.m_SettingConfig, System.IO.FileMode.Open);
					xmlTextReader = new XmlTextReader(input);
					xmlTextReader.WhitespaceHandling = WhitespaceHandling.None;
					xmlTextReader.MoveToContent();
					if (xmlTextReader.Name != "configuration")
					{
						SystemConfiguration.ilog_0.Error("Can not find configuration node");
						throw new System.ApplicationException("Can not find configuration node");
					}
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "Capture")
					{
						throw new System.ApplicationException("capture node error");
					}
					this.int_9 = System.Convert.ToInt32(xmlTextReader.GetAttribute("captureNextImageTime"));
					this.int_10 = System.Convert.ToInt32(xmlTextReader.GetAttribute("captureImageCount"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "Display")
					{
						throw new System.ApplicationException("display node not found");
					}
					this.bool_2 = System.Convert.ToBoolean(xmlTextReader.GetAttribute("displaySuccessfullResultOnly"));
					this.int_15 = System.Convert.ToInt32(xmlTextReader.GetAttribute("numberEventDisplay"));
					this.bool_3 = System.Convert.ToBoolean(xmlTextReader.GetAttribute("displayCPUUsage"));
					this.bool_5 = System.Convert.ToBoolean(xmlTextReader.GetAttribute("displayAUXControlSettingPage"));
					this.string_15 = xmlTextReader.GetAttribute("backColor");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "ImageFolder")
					{
						throw new System.ApplicationException("image folder node not found");
					}
					this.m_ImgPath = xmlTextReader.GetAttribute("imageFolder");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "Recognize")
					{
						throw new System.ApplicationException("recognize setting not found");
					}
					this.int_11 = System.Convert.ToInt32(xmlTextReader.GetAttribute("recognizeMethod"));
					this.int_12 = System.Convert.ToInt32(xmlTextReader.GetAttribute("recognizeIdleTime"));
					this.int_13 = System.Convert.ToInt32(xmlTextReader.GetAttribute("minCharHeight"));
					this.int_14 = System.Convert.ToInt32(xmlTextReader.GetAttribute("maxCharHeight"));
					this.string_4 = xmlTextReader.GetAttribute("countryCode");
					this.string_5 = this.string_4;
					this.string_6 = xmlTextReader.GetAttribute("provinceCode");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "REDLightRegion")
					{
						throw new System.ApplicationException("red light region setting not found");
					}
					string[] array = xmlTextReader.GetAttribute("redLightRegion").Split(new char[]
					{
						','
					});
					this.rectangle_0 = new System.Drawing.Rectangle(System.Convert.ToInt32(array[0]), System.Convert.ToInt32(array[1]), System.Convert.ToInt32(array[2]), System.Convert.ToInt32(array[3]));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "GREENLightRegion")
					{
						throw new System.ApplicationException("green light region setting not found");
					}
					array = xmlTextReader.GetAttribute("greenLightRegion").Split(new char[]
					{
						','
					});
					this.rectangle_1 = new System.Drawing.Rectangle(System.Convert.ToInt32(array[0]), System.Convert.ToInt32(array[1]), System.Convert.ToInt32(array[2]), System.Convert.ToInt32(array[3]));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "YELLOWLightRegion")
					{
						throw new System.ApplicationException("yellow light region setting not found");
					}
					array = xmlTextReader.GetAttribute("yellowLightRegion").Split(new char[]
					{
						','
					});
					this.rectangle_2 = new System.Drawing.Rectangle(System.Convert.ToInt32(array[0]), System.Convert.ToInt32(array[1]), System.Convert.ToInt32(array[2]), System.Convert.ToInt32(array[3]));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "TimeStartStopRedLight")
					{
						throw new System.ApplicationException("TimeStartStopRedLight setting not found");
					}
					this.dateTime_0 = System.Convert.ToDateTime(xmlTextReader.GetAttribute("timeStart"));
					this.dateTime_1 = System.Convert.ToDateTime(xmlTextReader.GetAttribute("timeStop"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "RGBLimitRED")
					{
						throw new System.ApplicationException("RGB limit RED not found!");
					}
					this.gclass3_0.int_1 = System.Convert.ToInt32(xmlTextReader.GetAttribute("rMin"));
					this.gclass3_0.int_0 = System.Convert.ToInt32(xmlTextReader.GetAttribute("rMax"));
					this.gclass3_0.int_3 = System.Convert.ToInt32(xmlTextReader.GetAttribute("gMin"));
					this.gclass3_0.int_2 = System.Convert.ToInt32(xmlTextReader.GetAttribute("gMax"));
					this.gclass3_0.int_5 = System.Convert.ToInt32(xmlTextReader.GetAttribute("bMin"));
					this.gclass3_0.int_4 = System.Convert.ToInt32(xmlTextReader.GetAttribute("bMax"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "RGBLimitGREEN")
					{
						throw new System.ApplicationException("RGB limit GREEN not found!");
					}
					this.gclass3_1.int_1 = System.Convert.ToInt32(xmlTextReader.GetAttribute("rMin"));
					this.gclass3_1.int_0 = System.Convert.ToInt32(xmlTextReader.GetAttribute("rMax"));
					this.gclass3_1.int_3 = System.Convert.ToInt32(xmlTextReader.GetAttribute("gMin"));
					this.gclass3_1.int_2 = System.Convert.ToInt32(xmlTextReader.GetAttribute("gMax"));
					this.gclass3_1.int_5 = System.Convert.ToInt32(xmlTextReader.GetAttribute("bMin"));
					this.gclass3_1.int_4 = System.Convert.ToInt32(xmlTextReader.GetAttribute("bMax"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "RGBLimitYELLOW")
					{
						throw new System.ApplicationException("RGB limit YELLOW not found!");
					}
					this.gclass3_2.int_1 = System.Convert.ToInt32(xmlTextReader.GetAttribute("rMin"));
					this.gclass3_2.int_0 = System.Convert.ToInt32(xmlTextReader.GetAttribute("rMax"));
					this.gclass3_2.int_3 = System.Convert.ToInt32(xmlTextReader.GetAttribute("gMin"));
					this.gclass3_2.int_2 = System.Convert.ToInt32(xmlTextReader.GetAttribute("gMax"));
					this.gclass3_2.int_5 = System.Convert.ToInt32(xmlTextReader.GetAttribute("bMin"));
					this.gclass3_2.int_4 = System.Convert.ToInt32(xmlTextReader.GetAttribute("bMax"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "RGBLimitBLACK")
					{
						throw new System.ApplicationException("RGB limit BLACK not found!");
					}
					this.gclass3_3.int_1 = System.Convert.ToInt32(xmlTextReader.GetAttribute("rMin"));
					this.gclass3_3.int_0 = System.Convert.ToInt32(xmlTextReader.GetAttribute("rMax"));
					this.gclass3_3.int_3 = System.Convert.ToInt32(xmlTextReader.GetAttribute("gMin"));
					this.gclass3_3.int_2 = System.Convert.ToInt32(xmlTextReader.GetAttribute("gMax"));
					this.gclass3_3.int_5 = System.Convert.ToInt32(xmlTextReader.GetAttribute("bMin"));
					this.gclass3_3.int_4 = System.Convert.ToInt32(xmlTextReader.GetAttribute("bMax"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "RedLightAnalyze")
					{
						throw new System.ApplicationException("red light analyze not found!");
					}
					this.int_2 = System.Convert.ToInt32(xmlTextReader.GetAttribute("redLightAnalyzeMode"));
					this.int_3 = System.Convert.ToInt32(xmlTextReader.GetAttribute("differenceFromRedColor"));
					this.int_4 = System.Convert.ToInt32(xmlTextReader.GetAttribute("redLightAnalyzeInterval"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "LimitLightTime")
					{
						throw new System.ApplicationException("limit light time not found!");
					}
					this.int_5 = System.Convert.ToInt32(xmlTextReader.GetAttribute("redLightTime"));
					this.int_6 = System.Convert.ToInt32(xmlTextReader.GetAttribute("greenLightTime"));
					this.int_7 = System.Convert.ToInt32(xmlTextReader.GetAttribute("greenLightDelay"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "LaneAnalyze")
					{
						throw new System.ApplicationException("lane analyze not found!");
					}
					this.int_0 = System.Convert.ToInt32(xmlTextReader.GetAttribute("laneAnalyzeInterval1"));
					this.int_1 = System.Convert.ToInt32(xmlTextReader.GetAttribute("laneAnalyzeInterval2"));
					this.bool_0 = System.Convert.ToBoolean(xmlTextReader.GetAttribute("usingAllMotionRegionForLane1"));
					this.bool_1 = System.Convert.ToBoolean(xmlTextReader.GetAttribute("usingAllMotionRegionForLane2"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "MaxLane")
					{
						throw new System.ApplicationException("max lane not found!");
					}
					this.int_16 = System.Convert.ToInt32(xmlTextReader.GetAttribute("maxLane"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "DelayTimeAfterRedLight")
					{
						throw new System.ApplicationException("delay time after red light not found!");
					}
					this.int_8 = System.Convert.ToInt32(xmlTextReader.GetAttribute("delayTimeAfterRedLight"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "LastTimeReceivedFrameLimit")
					{
						throw new System.ApplicationException("using last time received frame limit not found");
					}
					this.int_21 = System.Convert.ToInt32(xmlTextReader.GetAttribute("lastTimeReceivedFrameLimit"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "RememberLogin")
					{
						throw new System.ApplicationException("remember login setting not found");
					}
					this.bool_6 = System.Convert.ToBoolean(xmlTextReader.GetAttribute("rememberLogin"));
					this.string_9 = xmlTextReader.GetAttribute("login");
					this.string_10 = xmlTextReader.GetAttribute("password");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "LaneLocation")
					{
						throw new System.ApplicationException("lane location setting not found");
					}
					this.string_11 = xmlTextReader.GetAttribute("laneLocation");
					this.string_12 = xmlTextReader.GetAttribute("provinceName");
					this.string_13 = xmlTextReader.GetAttribute("violationDescription");
					this.string_14 = xmlTextReader.GetAttribute("departmentManagement");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "TimeDelay")
					{
						throw new System.ApplicationException("time delay setting not found");
					}
					this.int_17 = System.Convert.ToInt32(xmlTextReader.GetAttribute("printInterval"));
					this.int_18 = System.Convert.ToInt32(xmlTextReader.GetAttribute("deleteInterval"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					string key = CryptorEngine.key;
					CryptorEngine.key = "@#$Le Hong Thai$#@";
					string text = CryptorEngine.Decrypt(this.string_4, true);
                    if (RegisterationInfo.m_ActivationKey != string.Empty && text.Length > 8 && RegisterationInfo.m_ActivationKey == text.Substring(0, text.Length - 8))
					{
                        this.string_4 = text.Substring(RegisterationInfo.m_ActivationKey.Length + 1);
					}
					CryptorEngine.key = key;
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Error while reading config file: " + ex.ToString());
					SystemConfiguration.ilog_0.Error(ex);
				}
				return;
			}
			finally
			{
				if (xmlTextReader != null)
				{
					xmlTextReader.Close();
				}
			}
		}
		MessageBox.Show("Không tìm thấy file cấu hình hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
		SystemConfiguration.ilog_0.Error("The config file can not found.");
	}
	public void method_8()
	{
		try
		{
			System.IO.FileStream w = new System.IO.FileStream(this.m_SettingConfig, System.IO.FileMode.Create);
			XmlTextWriter xmlTextWriter = new XmlTextWriter(w, System.Text.Encoding.UTF8);
			xmlTextWriter.Formatting = Formatting.Indented;
			xmlTextWriter.WriteStartDocument();
			xmlTextWriter.WriteStartElement("configuration");
			xmlTextWriter.WriteStartElement("Capture");
			xmlTextWriter.WriteAttributeString("captureNextImageTime", this.int_9.ToString());
			xmlTextWriter.WriteAttributeString("captureImageCount", this.int_10.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("Display");
			xmlTextWriter.WriteAttributeString("displaySuccessfullResultOnly", this.bool_2.ToString());
			xmlTextWriter.WriteAttributeString("numberEventDisplay", this.int_15.ToString());
			xmlTextWriter.WriteAttributeString("displayCPUUsage", this.bool_3.ToString());
			xmlTextWriter.WriteAttributeString("displayAUXControlSettingPage", this.bool_5.ToString());
			xmlTextWriter.WriteAttributeString("backColor", this.string_15);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("ImageFolder");
			xmlTextWriter.WriteAttributeString("imageFolder", this.m_ImgPath);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("Recognize");
			xmlTextWriter.WriteAttributeString("recognizeMethod", this.int_11.ToString());
			xmlTextWriter.WriteAttributeString("recognizeIdleTime", this.int_12.ToString());
			xmlTextWriter.WriteAttributeString("minCharHeight", this.int_13.ToString());
			xmlTextWriter.WriteAttributeString("maxCharHeight", this.int_14.ToString());
			xmlTextWriter.WriteAttributeString("countryCode", this.string_5);
			xmlTextWriter.WriteAttributeString("provinceCode", this.string_6);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("REDLightRegion");
			xmlTextWriter.WriteAttributeString("redLightRegion", string.Concat(new object[]
			{
				this.rectangle_0.X,
				",",
				this.rectangle_0.Y,
				",",
				this.rectangle_0.Width,
				",",
				this.rectangle_0.Height
			}));
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("GREENLightRegion");
			xmlTextWriter.WriteAttributeString("greenLightRegion", string.Concat(new object[]
			{
				this.rectangle_1.X,
				",",
				this.rectangle_1.Y,
				",",
				this.rectangle_1.Width,
				",",
				this.rectangle_1.Height
			}));
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("YELLOWLightRegion");
			xmlTextWriter.WriteAttributeString("yellowLightRegion", string.Concat(new object[]
			{
				this.rectangle_2.X,
				",",
				this.rectangle_2.Y,
				",",
				this.rectangle_2.Width,
				",",
				this.rectangle_2.Height
			}));
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("TimeStartStopRedLight");
			xmlTextWriter.WriteAttributeString("timeStart", this.dateTime_0.ToString());
			xmlTextWriter.WriteAttributeString("timeStop", this.dateTime_1.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("RGBLimitRED");
			xmlTextWriter.WriteAttributeString("rMin", this.gclass3_0.int_1.ToString());
			xmlTextWriter.WriteAttributeString("rMax", this.gclass3_0.int_0.ToString());
			xmlTextWriter.WriteAttributeString("gMin", this.gclass3_0.int_3.ToString());
			xmlTextWriter.WriteAttributeString("gMax", this.gclass3_0.int_2.ToString());
			xmlTextWriter.WriteAttributeString("bMin", this.gclass3_0.int_5.ToString());
			xmlTextWriter.WriteAttributeString("bMax", this.gclass3_0.int_4.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("RGBLimitGREEN");
			xmlTextWriter.WriteAttributeString("rMin", this.gclass3_1.int_1.ToString());
			xmlTextWriter.WriteAttributeString("rMax", this.gclass3_1.int_0.ToString());
			xmlTextWriter.WriteAttributeString("gMin", this.gclass3_1.int_3.ToString());
			xmlTextWriter.WriteAttributeString("gMax", this.gclass3_1.int_2.ToString());
			xmlTextWriter.WriteAttributeString("bMin", this.gclass3_1.int_5.ToString());
			xmlTextWriter.WriteAttributeString("bMax", this.gclass3_1.int_4.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("RGBLimitYELLOW");
			xmlTextWriter.WriteAttributeString("rMin", this.gclass3_2.int_1.ToString());
			xmlTextWriter.WriteAttributeString("rMax", this.gclass3_2.int_0.ToString());
			xmlTextWriter.WriteAttributeString("gMin", this.gclass3_2.int_3.ToString());
			xmlTextWriter.WriteAttributeString("gMax", this.gclass3_2.int_2.ToString());
			xmlTextWriter.WriteAttributeString("bMin", this.gclass3_2.int_5.ToString());
			xmlTextWriter.WriteAttributeString("bMax", this.gclass3_2.int_4.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("RGBLimitBLACK");
			xmlTextWriter.WriteAttributeString("rMin", this.gclass3_3.int_1.ToString());
			xmlTextWriter.WriteAttributeString("rMax", this.gclass3_3.int_0.ToString());
			xmlTextWriter.WriteAttributeString("gMin", this.gclass3_3.int_3.ToString());
			xmlTextWriter.WriteAttributeString("gMax", this.gclass3_3.int_2.ToString());
			xmlTextWriter.WriteAttributeString("bMin", this.gclass3_3.int_5.ToString());
			xmlTextWriter.WriteAttributeString("bMax", this.gclass3_3.int_4.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("RedLightAnalyze");
			xmlTextWriter.WriteAttributeString("redLightAnalyzeMode", this.int_2.ToString());
			xmlTextWriter.WriteAttributeString("differenceFromRedColor", this.int_3.ToString());
			xmlTextWriter.WriteAttributeString("redLightAnalyzeInterval", this.int_4.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("LimitLightTime");
			xmlTextWriter.WriteAttributeString("redLightTime", this.int_5.ToString());
			xmlTextWriter.WriteAttributeString("greenLightTime", this.int_6.ToString());
			xmlTextWriter.WriteAttributeString("greenLightDelay", this.int_7.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("LaneAnalyze");
			xmlTextWriter.WriteAttributeString("laneAnalyzeInterval1", this.int_0.ToString());
			xmlTextWriter.WriteAttributeString("laneAnalyzeInterval2", this.int_1.ToString());
			xmlTextWriter.WriteAttributeString("usingAllMotionRegionForLane1", this.bool_0.ToString());
			xmlTextWriter.WriteAttributeString("usingAllMotionRegionForLane2", this.bool_1.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("MaxLane");
			xmlTextWriter.WriteAttributeString("maxLane", this.int_16.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("DelayTimeAfterRedLight");
			xmlTextWriter.WriteAttributeString("delayTimeAfterRedLight", this.int_8.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("LastTimeReceivedFrameLimit");
			xmlTextWriter.WriteAttributeString("lastTimeReceivedFrameLimit", this.int_21.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("RememberLogin");
			xmlTextWriter.WriteAttributeString("rememberLogin", this.bool_6.ToString());
			xmlTextWriter.WriteAttributeString("login", this.string_9);
			xmlTextWriter.WriteAttributeString("password", this.string_10);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("LaneLocation");
			xmlTextWriter.WriteAttributeString("laneLocation", this.string_11);
			xmlTextWriter.WriteAttributeString("provinceName", this.string_12);
			xmlTextWriter.WriteAttributeString("violationDescription", this.string_13);
			xmlTextWriter.WriteAttributeString("departmentManagement", this.string_14);
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteStartElement("TimeDelay");
			xmlTextWriter.WriteAttributeString("printInterval", this.int_17.ToString());
			xmlTextWriter.WriteAttributeString("deleteInterval", this.int_18.ToString());
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.WriteEndElement();
			xmlTextWriter.Close();
		}
		catch (System.Exception ex)
		{
			MessageBox.Show(ex.ToString());
			SystemConfiguration.ilog_0.Error(ex);
		}
	}
	public static void smethod_0()
	{
		if (System.IO.File.Exists(SystemConfiguration.m_DatabaseConfig))
		{
			XmlTextReader xmlTextReader = null;
			try
			{
				try
				{
                    System.IO.FileStream input = new System.IO.FileStream(SystemConfiguration.m_DatabaseConfig, System.IO.FileMode.Open);
					xmlTextReader = new XmlTextReader(input);
					xmlTextReader.WhitespaceHandling = WhitespaceHandling.None;
					xmlTextReader.MoveToContent();
					if (xmlTextReader.Name != "configuration")
					{
						throw new System.ApplicationException("database configuration not found!");
					}
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "DatabaseType")
					{
						throw new System.ApplicationException("database type node not found!");
					}
					SystemConfiguration.m_DbType = System.Convert.ToInt32(xmlTextReader.GetAttribute("databaseType"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "Server")
					{
						throw new System.ApplicationException("server node not found!");
					}
					SystemConfiguration.m_ServerName = xmlTextReader.GetAttribute("server");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "Database")
					{
						throw new System.ApplicationException("database node notfound!");
					}
					SystemConfiguration.m_DatabaseName = xmlTextReader.GetAttribute("database");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "Authentication")
					{
						throw new System.ApplicationException("authentication node notfound!");
					}
					SystemConfiguration.m_Authentication = System.Convert.ToInt32(xmlTextReader.GetAttribute("authentication"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "UserName")
					{
						throw new System.ApplicationException("user name node not found!");
					}
					SystemConfiguration.m_UserName = xmlTextReader.GetAttribute("username");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "Password")
					{
						throw new System.ApplicationException("password node not found!");
					}
					SystemConfiguration.m_Password = xmlTextReader.GetAttribute("password");
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					if (xmlTextReader.Name != "EnableMARS")
					{
						throw new System.ApplicationException("mars node not found!");
					}
					SystemConfiguration.m_EnableMARS = System.Convert.ToBoolean(xmlTextReader.GetAttribute("enableMARS"));
					xmlTextReader.Read();
					if (xmlTextReader.NodeType == XmlNodeType.EndElement)
					{
						xmlTextReader.Read();
					}
					string key = CryptorEngine.key;
					CryptorEngine.key = "@#$Le Hong Thai$#@";
                    SystemConfiguration.m_UserName = CryptorEngine.Decrypt(SystemConfiguration.m_UserName, true);
                    SystemConfiguration.m_Password = CryptorEngine.Decrypt(SystemConfiguration.m_Password, true);
					CryptorEngine.key = key;
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Error while reading database config file: " + ex.ToString());
					SystemConfiguration.ilog_0.Error(ex);
				}
				return;
			}
			finally
			{
				if (xmlTextReader != null)
				{
					xmlTextReader.Close();
				}
			}
		}
		MessageBox.Show("Không tìm thấy file cấu hình hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
	}
	public static void smethod_1()
	{
        System.IO.FileStream w = new System.IO.FileStream(SystemConfiguration.m_DatabaseConfig, System.IO.FileMode.Create);
		XmlTextWriter xmlTextWriter = new XmlTextWriter(w, System.Text.Encoding.UTF8);
		xmlTextWriter.Formatting = Formatting.Indented;
		xmlTextWriter.WriteStartDocument();
		xmlTextWriter.WriteStartElement("configuration");
		xmlTextWriter.WriteStartElement("DatabaseType");
		xmlTextWriter.WriteAttributeString("databaseType", SystemConfiguration.m_DbType.ToString());
		xmlTextWriter.WriteEndElement();
		xmlTextWriter.WriteStartElement("Server");
		xmlTextWriter.WriteAttributeString("server", SystemConfiguration.m_ServerName);
		xmlTextWriter.WriteEndElement();
		xmlTextWriter.WriteStartElement("Database");
		xmlTextWriter.WriteAttributeString("database", SystemConfiguration.m_DatabaseName);
		xmlTextWriter.WriteEndElement();
		xmlTextWriter.WriteStartElement("Authentication");
		xmlTextWriter.WriteAttributeString("authentication", SystemConfiguration.m_Authentication.ToString());
		xmlTextWriter.WriteEndElement();
		xmlTextWriter.WriteStartElement("UserName");
		xmlTextWriter.WriteAttributeString("username", SystemConfiguration.m_UserName);
		xmlTextWriter.WriteEndElement();
		xmlTextWriter.WriteStartElement("Password");
		xmlTextWriter.WriteAttributeString("password", SystemConfiguration.m_Password);
		xmlTextWriter.WriteEndElement();
		xmlTextWriter.WriteStartElement("EnableMARS");
		xmlTextWriter.WriteAttributeString("enableMARS", SystemConfiguration.m_EnableMARS.ToString());
		xmlTextWriter.WriteEndElement();
		xmlTextWriter.WriteEndElement();
		xmlTextWriter.Close();
	}
	public void method_9()
	{
		string text = "Select * from tblUser order by ID";
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
						BO5 gClass = new BO5();
						gClass.method_1(System.Convert.ToInt32(dataRow["ID"].ToString()));
						gClass.method_3(dataRow["UserName"].ToString());
						gClass.method_5(dataRow["Login"].ToString());
						gClass.method_7(dataRow["Password"].ToString());
						gClass.method_9(System.Convert.ToInt32(dataRow["Right"].ToString()));
						gClass.method_11(dataRow["Description"].ToString());
						this.ExtendCollection_0.Add(gClass);
						this.int_24 = gClass.method_0() + 1;
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL: " + ex.Message, "Lỗi truy cập CSDL", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public bool method_10(BO5 gclass2_0)
	{
		string text = string.Concat(new object[]
		{
			"insert into tblUser (ID, UserName, [Login], [Password], [Right], Description) values (",
			gclass2_0.method_0(),
			", '",
			gclass2_0.method_2(),
			"', '",
			gclass2_0.method_4(),
			"', '",
			gclass2_0.method_6(),
			"', ",
			gclass2_0.method_8(),
			", '",
			gclass2_0.method_10(),
			"')"
		});
		if (this.iconnection_0.ExecuteCommand(text))
		{
			this.ExtendCollection_0.Add(gclass2_0);
			return true;
		}
		return false;
	}
	public bool method_11(BO5 gclass2_0, string string_20, string string_21, string string_22, int int_26, string string_23)
	{
		string text = string.Concat(new object[]
		{
			"update tblUser set UserName = '",
			string_20,
			"', [Login] = '",
			string_21,
			"', [Password] = '",
			string_22,
			"', [Right] = ",
			int_26,
			", Description = '",
			string_23,
			"' where ID = ",
			gclass2_0.method_0()
		});
		if (this.iconnection_0.ExecuteCommand(text))
		{
			gclass2_0.method_3(string_20);
			gclass2_0.method_5(string_21);
			gclass2_0.method_7(string_22);
			gclass2_0.method_9(int_26);
			gclass2_0.method_11(string_23);
			return true;
		}
		return false;
	}
	public bool method_12(BO5 gclass2_0)
	{
		string text = "delete from tblUser where ID = " + gclass2_0.method_0();
		if (this.iconnection_0.ExecuteCommand(text))
		{
			this.ExtendCollection_0.Remove(gclass2_0);
			return true;
		}
		return false;
	}
	public bool method_13(BO5 gclass2_0, string string_20)
	{
		string text = string.Concat(new object[]
		{
			"update tblUser set [Password] = '",
			string_20,
			"' where ID = ",
			gclass2_0.method_0()
		});
		if (this.iconnection_0.ExecuteCommand(text))
		{
			gclass2_0.method_7(string_20);
			return true;
		}
		return false;
	}
	public void method_14(Control control_0, string string_20, object object_0)
	{
		try
		{
			if (control_0.InvokeRequired)
			{
				SystemConfiguration.Delegate0 method = new SystemConfiguration.Delegate0(this.method_14);
				control_0.Invoke(method, new object[]
				{
					control_0,
					string_20,
					object_0
				});
			}
			else
			{
				System.Type type = control_0.GetType();
				System.Reflection.PropertyInfo[] properties = type.GetProperties();
				System.Reflection.PropertyInfo[] array = properties;
				for (int i = 0; i < array.Length; i++)
				{
					System.Reflection.PropertyInfo propertyInfo = array[i];
					if (propertyInfo.Name.ToUpper() == string_20.ToUpper())
					{
						propertyInfo.SetValue(control_0, object_0, null);
					}
				}
			}
		}
		catch (System.Exception ex)
		{
			SystemConfiguration.ilog_0.Error(ex);
		}
	}
	public void method_15(DataGridView dataGridView_0, string string_20)
	{
		dataGridView_0.Rows.Clear();
		string text = "select * from tblEvent " + string_20;
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					string[] array = new string[]
					{
						"Xe gắn máy",
						"Xe môtô",
						"Xe ôtô"
					};
					System.Drawing.Color white = System.Drawing.Color.White;
					int num = 0;
					for (int i = 0; i < count; i++)
					{
						num++;
						DataRow dataRow = table.Rows[i];
						int num2 = 0;
						if (dataRow["VehicleType"].ToString() != string.Empty)
						{
							num2 = System.Convert.ToInt32(dataRow["VehicleType"].ToString());
						}
						string text2 = dataRow["PlateNumber"].ToString();
						dataGridView_0.Rows.Add(new object[]
						{
							num.ToString(),
							dataRow["ID"].ToString(),
							System.Convert.ToDateTime(dataRow["EventDateTime"].ToString()).ToString("dd/MM/yyyy"),
							System.Convert.ToDateTime(dataRow["EventDateTime"].ToString()).ToString("HH:mm:ss"),
							array[num2],
							text2,
							dataRow["RecognizeTime"].ToString(),
							dataRow["VehicleImagePath"].ToString(),
							dataRow["PanoramaImagePath"].ToString(),
							dataRow["RedLightImagePath"].ToString(),
							dataRow["Description"].ToString()
						});
						dataGridView_0.Rows[i].DefaultCellStyle.BackColor = white;
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/DisplayViolationRport(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public void method_16(DataGridView dataGridView_0, string string_20, ref int int_26, ref int int_27)
	{
		dataGridView_0.Rows.Clear();
		string text = "select * from tblEvent " + string_20;
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					string[] array = new string[]
					{
						"Xe gắn máy",
						"Xe môtô",
						"Xe ôtô"
					};
					System.Drawing.Color backColor = System.Drawing.Color.White;
					int num = 0;
					for (int i = 0; i < count; i++)
					{
						num++;
						DataRow dataRow = table.Rows[i];
						int num2 = 0;
						if (dataRow["VehicleType"].ToString() != string.Empty)
						{
							num2 = System.Convert.ToInt32(dataRow["VehicleType"].ToString());
						}
						string text2 = dataRow["PlateNumber"].ToString();
						dataGridView_0.Rows.Add(new object[]
						{
							num.ToString(),
							dataRow["ID"].ToString(),
							System.Convert.ToDateTime(dataRow["EventDateTime"].ToString()).ToString("dd/MM/yyyy"),
							System.Convert.ToDateTime(dataRow["EventDateTime"].ToString()).ToString("HH:mm:ss"),
							array[num2],
							text2,
							dataRow["RecognizeTime"].ToString(),
							dataRow["VehicleImagePath"].ToString(),
							dataRow["PanoramaImagePath"].ToString(),
							dataRow["RedLightImagePath"].ToString(),
							dataRow["Description"].ToString()
						});
						foreach (BO1 gClass in this.gclass4_0)
						{
							if (gClass.method_2() == text2)
							{
								if (!gClass.method_12())
								{
									if (!gClass.method_14())
									{
										backColor = System.Drawing.Color.White;
										continue;
									}
									backColor = System.Drawing.Color.LightPink;
									int_27++;
								}
								else
								{
									backColor = System.Drawing.Color.DarkGray;
									int_26++;
								}
								break;
							}
							backColor = System.Drawing.Color.White;
						}
						dataGridView_0.Rows[i].DefaultCellStyle.BackColor = backColor;
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/DisplayViolationRport(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public void method_17(System.DateTime dateTime_2, System.DateTime dateTime_3)
	{
		string text = string.Concat(new object[]
		{
			"select * from tblEvent where EventDateTime >= #",
			dateTime_2,
			"# and EventDateTime <= #",
			dateTime_3,
			"#"
		});
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
						string text2 = dataRow["VehicleImagePath"].ToString();
						string obj = dataRow["PanoramaImagePath"].ToString();
						string obj2 = dataRow["RedLightImagePath"].ToString();
						string obj3 = dataRow["TransactionPath"].ToString();
						MainForm.queue_1.Enqueue(text2);
						MainForm.queue_1.Enqueue(obj);
						MainForm.queue_1.Enqueue(obj2);
						MainForm.queue_1.Enqueue(obj3);
						MainForm.queue_1.Enqueue(text2 + ".jpg");
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/DisplayViolationRport(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public void method_18(System.DateTime dateTime_2, System.DateTime dateTime_3)
	{
		string text = string.Concat(new object[]
		{
			"delete from tblEvent where EventDateTime >= #",
			dateTime_2,
			"# and EventDateTime <= #",
			dateTime_3,
			"#"
		});
		this.iconnection_0.ExecuteCommand(text);
	}
	public void method_19()
	{
		this.ExtendCollection0_0.Clear();
		string text = "select * from tblProvince order by ID";
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
						BO4 gClass = new BO4();
						gClass.method_1(System.Convert.ToInt32(dataRow["ID"].ToString()));
						gClass.method_3(dataRow["ProvinceName"].ToString());
						gClass.method_5(dataRow["ProvinceCode"].ToString());
						this.ExtendCollection0_0.Add(gClass);
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/LoadProvince(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public void method_20()
	{
		this.gclass8_0.Clear();
		string text = "select * from tblDistrict order by ID";
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
						BO3 gClass = new BO3();
						gClass.method_1(System.Convert.ToInt32(dataRow["ID"].ToString()));
						gClass.method_3(dataRow["DistrictName"].ToString());
						gClass.method_5(System.Convert.ToInt32(dataRow["ProvinceID"].ToString()));
						this.gclass8_0.Add(gClass);
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/LoadDistrict(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public void method_21()
	{
		this.gclass6_0.Clear();
		string text = "select * from tblWard order by ID";
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
						BO2 gClass = new BO2();
						gClass.method_1(System.Convert.ToInt32(dataRow["ID"].ToString()));
						gClass.method_3(dataRow["WardName"].ToString());
						gClass.method_5(System.Convert.ToInt32(dataRow["DistrictID"].ToString()));
						gClass.method_7(System.Convert.ToInt32(dataRow["ProvinceID"].ToString()));
						this.gclass6_0.Add(gClass);
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/LoadWard(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public void method_22()
	{
		this.gclass4_0.Clear();
		string text = "select * from tblVehicle order by ID";
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
                        BO1 gClass = new BO1();
						gClass.method_1(System.Convert.ToInt32(dataRow["ID"].ToString()));
						gClass.method_3(dataRow["PlateNumber"].ToString());
						gClass.method_5(dataRow["OwnerName"].ToString());
						gClass.method_7(dataRow["OwnerIDCard"].ToString());
						gClass.method_9(dataRow["OwnerAddress"].ToString());
						gClass.method_11(System.Convert.ToInt32(dataRow["WardID"].ToString()));
						gClass.method_13(System.Convert.ToBoolean(dataRow["IsBlacklist"].ToString()));
						gClass.method_15(System.Convert.ToBoolean(dataRow["IsSpeciallist"].ToString()));
						gClass.method_17(dataRow["Description"].ToString());
						this.int_25 = gClass.method_0() + 1;
						this.gclass4_0.Add(gClass);
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/LoadVehicle(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public bool method_23(int int_26, string string_20, string string_21, string string_22, string string_23, int int_27, bool bool_8, string string_24)
	{
		string text = string.Concat(new object[]
		{
			"insert into tblVehicle (ID, PlateNumber, OwnerName, OwnerIDCard, OwnerAddress, WardID, IsBlacklist, Description) values (",
			int_26,
			", '",
			string_20,
			"', '",
			string_21,
			"', '",
			string_22,
			"', '",
			string_23,
			"', ",
			int_27,
			", ",
			bool_8,
			", '",
			string_24,
			"')"
		});
		if (this.iconnection_0.ExecuteCommand(text))
		{
            BO1 gClass = new BO1();
			gClass.method_1(int_26);
			gClass.method_3(string_20);
			gClass.method_5(string_21);
			gClass.method_7(string_22);
			gClass.method_9(string_23);
			gClass.method_11(int_27);
			gClass.method_13(bool_8);
			gClass.method_17(string_24);
			this.gclass4_0.Add(gClass);
			return true;
		}
		return false;
	}
	public bool method_24(BO1 gclass5_0)
	{
		string text = string.Concat(new object[]
		{
			"insert into tblVehicle (ID, PlateNumber, OwnerName, OwnerIDCard, OwnerAddress, WardID, IsBlacklist, IsSpeciallist, Description) values (",
			gclass5_0.method_0(),
			", '",
			gclass5_0.method_2(),
			"', '",
			gclass5_0.method_4(),
			"', '",
			gclass5_0.method_6(),
			"', '",
			gclass5_0.method_8(),
			"', ",
			gclass5_0.method_10(),
			", ",
			gclass5_0.method_12(),
			",",
			gclass5_0.method_14(),
			", '",
			gclass5_0.method_16(),
			"')"
		});
		if (this.iconnection_0.ExecuteCommand(text))
		{
			this.gclass4_0.Add(gclass5_0);
			return true;
		}
		return false;
	}
	public bool method_25(BO1 gclass5_0, string string_20, string string_21, string string_22, string string_23, int int_26, bool bool_8, bool bool_9, string string_24)
	{
		string text = string.Concat(new object[]
		{
			"update tblVehicle set PlateNumber = '",
			string_20,
			"', OwnerName = '",
			string_21,
			"', OwnerIDCard = '",
			string_22,
			"', OwnerAddress = '",
			string_23,
			"', WardID = ",
			int_26,
			", IsBlacklist = ",
			bool_8,
			", IsSpeciallist = ",
			bool_9,
			", Description = '",
			string_24,
			"' where ID = ",
			gclass5_0.method_0()
		});
		if (this.iconnection_0.ExecuteCommand(text))
		{
			gclass5_0.method_3(string_20);
			gclass5_0.method_5(string_21);
			gclass5_0.method_7(string_22);
			gclass5_0.method_9(string_23);
			gclass5_0.method_11(int_26);
			gclass5_0.method_13(bool_8);
			gclass5_0.method_15(bool_9);
			gclass5_0.method_17(string_24);
			return true;
		}
		return false;
	}
    public bool method_26(BO1 gclass5_0)
	{
		string text = "delete from tblVehicle where ID = " + gclass5_0.method_0();
		if (this.iconnection_0.ExecuteCommand(text))
		{
			this.gclass4_0.Remove(gclass5_0);
			return true;
		}
		return false;
	}
	public void method_27(DataGridView dataGridView_0, string string_20)
	{
		dataGridView_0.Rows.Clear();
		string text = "select * from tblVehicle" + string_20 + " order by ID";
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					System.Drawing.Color backColor = System.Drawing.Color.White;
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
						int num = i + 1;
						dataGridView_0.Rows.Add(new object[]
						{
							num.ToString(),
							dataRow["ID"].ToString(),
							dataRow["PlateNumber"].ToString(),
							dataRow["OwnerName"].ToString(),
							dataRow["OwnerIDCard"].ToString(),
							dataRow["OwnerAddress"].ToString(),
							dataRow["WardID"].ToString(),
							dataRow["IsBlacklist"],
							dataRow["Description"].ToString()
						});
						if (i % 2 == 0)
						{
							backColor = System.Drawing.Color.Beige;
						}
						else
						{
							backColor = System.Drawing.Color.White;
						}
						dataGridView_0.Rows[i].DefaultCellStyle.BackColor = backColor;
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/DisplayVehicle(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public void method_28(DataGridView dataGridView_0, string string_20)
	{
		dataGridView_0.Rows.Clear();
		string text = "select * from tblVehicle" + string_20 + " order by ID";
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					System.Drawing.Color backColor = System.Drawing.Color.White;
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
						int num = i + 1;
						dataGridView_0.Rows.Add(new object[]
						{
							num.ToString(),
							dataRow["ID"].ToString(),
							dataRow["PlateNumber"].ToString(),
							dataRow["OwnerName"].ToString(),
							dataRow["OwnerAddress"].ToString(),
							dataRow["Description"].ToString()
						});
						if (i % 2 == 0)
						{
							backColor = System.Drawing.Color.Beige;
						}
						else
						{
							backColor = System.Drawing.Color.White;
						}
						dataGridView_0.Rows[i].DefaultCellStyle.BackColor = backColor;
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/DisplayVehicle(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public void method_29(DataGridView dataGridView_0, string string_20)
	{
		dataGridView_0.Rows.Clear();
		string text = "select * from tblVehicle" + string_20 + " order by ID";
		DataTable table = this.iconnection_0.GetTable(text);
		if (table != null)
		{
			int count = table.Rows.Count;
			if (count > 0)
			{
				try
				{
					System.Drawing.Color backColor = System.Drawing.Color.White;
					for (int i = 0; i < count; i++)
					{
						DataRow dataRow = table.Rows[i];
						int num = i + 1;
						dataGridView_0.Rows.Add(new object[]
						{
							num.ToString(),
							dataRow["ID"].ToString(),
							dataRow["PlateNumber"].ToString(),
							dataRow["OwnerName"].ToString(),
							dataRow["OwnerAddress"].ToString(),
							dataRow["Description"].ToString()
						});
						if (i % 2 == 0)
						{
							backColor = System.Drawing.Color.Beige;
						}
						else
						{
							backColor = System.Drawing.Color.White;
						}
						dataGridView_0.Rows[i].DefaultCellStyle.BackColor = backColor;
					}
				}
				catch (System.Exception ex)
				{
					MessageBox.Show("Lỗi truy cập CSDL/DisplayVehicle(): " + ex.Message);
					SystemConfiguration.ilog_0.Error(ex);
				}
			}
		}
	}
	public System.Drawing.Color method_30(System.Drawing.Bitmap bitmap_0)
	{
		try
		{
			SystemConfiguration.Class1 @class = new SystemConfiguration.Class1();
			@class.ExtendCollection2_0 = new ExtendCollection2(bitmap_0);
			@class.ExtendCollection2_0.method_0();
			@class.int_0 = 0;
			@class.int_1 = 0;
			int width = bitmap_0.Width;
			@class.int_2 = bitmap_0.Height;
			Parallel.For(0, width, new Parallel.ForLoopBody(@class.method_0));
			@class.int_0 /= @class.int_1;
			@class.ExtendCollection2_0.method_4();
			if (@class.int_0 >= 0 && @class.int_0 <= 255)
			{
				return System.Drawing.Color.FromArgb(@class.int_0, 0, 0);
			}
		}
		catch (System.Exception ex)
		{
			SystemConfiguration.ilog_0.Error(ex);
		}
		return System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.Control);
	}
	public unsafe System.Drawing.Color method_31(System.Drawing.Bitmap bitmap_0)
	{
        BitmapData bitmapdata = bitmap_0.LockBits(new Rectangle(0, 0, bitmap_0.Width, bitmap_0.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
        int stride = bitmapdata.Stride;
        IntPtr ptr = bitmapdata.Scan0;
        int red = 0;
        int num3 = 0;
        byte* numPtr = (byte*)ptr;
        int num4 = stride - bitmap_0.Width;
        int width = bitmap_0.Width;
        for (int i = 0; i < bitmap_0.Height; i++)
        {
            for (int j = 0; j < width; j++)
            {
                red += numPtr[0];
                num3++;
                numPtr += 2;
            }
            numPtr += num4;
        }
        bitmap_0.UnlockBits(bitmapdata);
        red /= num3;
        return Color.FromArgb(red, 0, 0);
	}
	public System.Drawing.Color method_32(int int_26, int int_27, int int_28)
	{
		if (this.int_2 == 0)
		{
			if (int_26 >= this.gclass3_0.int_1 && int_26 <= this.gclass3_0.int_0)
			{
				return System.Drawing.Color.Red;
			}
		}
		else
		{
			if (int_26 > this.gclass3_3.int_0)
			{
				return System.Drawing.Color.Red;
			}
		}
		return System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.Control);
	}
	private bool method_33(int int_26, int int_27, int int_28)
	{
		return int_26 >= this.gclass3_0.int_1 && int_26 <= this.gclass3_0.int_0 && int_27 >= this.gclass3_0.int_3 && int_27 <= this.gclass3_0.int_2 && int_28 >= this.gclass3_0.int_5 && int_28 <= this.gclass3_0.int_4;
	}
	private bool method_34(int int_26)
	{
		return int_26 <= this.gclass3_3.int_0;
	}
	public System.Drawing.Color method_35(System.Drawing.Color color_0)
	{
		int int_ = System.Convert.ToInt32(color_0.R);
		return this.method_32(int_, 0, 0);
	}
	public System.Drawing.Color method_36(System.Drawing.Color color_0, System.Drawing.Color color_1)
	{
		if (this.int_2 == 0)
		{
			if ((int)color_0.R >= this.gclass3_0.int_1 && (int)color_0.R <= this.gclass3_0.int_0)
			{
				return System.Drawing.Color.Red;
			}
		}
		else
		{
			if ((int)color_0.R > this.gclass3_3.int_0 && color_0.R > color_1.R && color_0.G > color_1.G)
			{
				return System.Drawing.Color.Red;
			}
		}
		return System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.Control);
	}
	public System.Drawing.Bitmap method_37(System.Drawing.Bitmap bitmap_0)
	{
		try
		{
			System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(bitmap_0.Width, bitmap_0.Height);
			System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
			float[][] array = new float[5][];
			array[0] = new float[]
			{
				0.3f,
				0.3f,
				0.3f,
				0f,
				0f
			};
			array[1] = new float[]
			{
				0.59f,
				0.59f,
				0.59f,
				0f,
				0f
			};
			array[2] = new float[]
			{
				0.11f,
				0.11f,
				0.11f,
				0f,
				0f
			};
			float[][] arg_76_0 = array;
			int arg_76_1 = 3;
			float[] array2 = new float[5];
			array2[3] = 1f;
			arg_76_0[arg_76_1] = array2;
			array[4] = new float[]
			{
				0f,
				0f,
				0f,
				0f,
				1f
			};
			System.Drawing.Imaging.ColorMatrix colorMatrix = new System.Drawing.Imaging.ColorMatrix(array);
			System.Drawing.Imaging.ImageAttributes imageAttributes = new System.Drawing.Imaging.ImageAttributes();
			imageAttributes.SetColorMatrix(colorMatrix);
			graphics.DrawImage(bitmap_0, new System.Drawing.Rectangle(0, 0, bitmap_0.Width, bitmap_0.Height), 0, 0, bitmap_0.Width, bitmap_0.Height, System.Drawing.GraphicsUnit.Pixel, imageAttributes);
			graphics.Dispose();
			return bitmap;
		}
		catch (System.Exception ex)
		{
			SystemConfiguration.ilog_0.Error(ex);
		}
		return null;
	}
	public void method_38(DataGridView dataGridView_0, string string_20, System.DateTime dateTime_2, System.DateTime dateTime_3)
	{
		System.DateTime dateTime = System.Convert.ToDateTime(dateTime_2.ToString("yyyy/MM/dd"));
		int num = 0;
		int num2 = 0;
		int num3 = 0;
		int num4 = 0;
		int num5 = 0;
		int num6 = 0;
		string text = string.Empty;
		try
		{
			dataGridView_0.Rows.Clear();
			text = "select EventDateTime, VehicleType from tblEvent " + string_20 + " order by EventDateTime";
			DataTable table = this.iconnection_0.GetTable(text);
			if (table != null)
			{
				int num7 = 1;
				foreach (DataRow dataRow in table.Rows)
				{
					System.DateTime dateTime2 = System.Convert.ToDateTime(System.Convert.ToDateTime(dataRow["EventDateTime"].ToString()).ToString("yyyy/MM/dd"));
					if (dateTime != dateTime2)
					{
						dataGridView_0.Rows.Add(new object[]
						{
							num7,
							dateTime.ToString("dd/MM/yyyy"),
							num2,
							num,
							num3
						});
						num4 += num;
						num5 += num2;
						num6 += num3;
						num = 0;
						num2 = 0;
						num7++;
						for (int i = (int)System.Convert.ToInt16((dateTime2 - dateTime).Days); i > 1; i--)
						{
							dateTime = dateTime.AddDays(1.0);
							dataGridView_0.Rows.Add(new object[]
							{
								num7,
								dateTime.ToString("dd/MM/yyyy"),
								0,
								0,
								0
							});
						}
						dateTime = dateTime2;
					}
					int num8 = 0;
					string a = dataRow["VehicleType"].ToString();
					if (a != string.Empty)
					{
						num8 = (int)System.Convert.ToInt16(dataRow["VehicleType"].ToString());
					}
					if (num8 == 2)
					{
						num2++;
					}
					else
					{
						num++;
					}
					num3 = num + num2;
				}
				dataGridView_0.Rows.Add(new object[]
				{
					num7,
					dateTime.ToString("dd/MM/yyyy"),
					num2,
					num,
					num3
				});
				while (dateTime.AddDays(1.0) < dateTime_3)
				{
					num7++;
					dateTime = dateTime.AddDays(1.0);
					dataGridView_0.Rows.Add(new object[]
					{
						num7,
						dateTime.ToString("dd/MM/yyyy"),
						0,
						0,
						0
					});
				}
				num4 += num;
				num5 += num2;
				num6 += num3;
				table.Dispose();
			}
		}
		catch (System.Exception ex)
		{
			MessageBox.Show("Error while loading and diplay tblEvent: " + ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			SystemConfiguration.ilog_0.Error(ex);
		}
		dataGridView_0.Rows.Add(new object[]
		{
			"Tổng",
			string.Empty,
			num5,
			num4,
			num6
		});
		dataGridView_0.Rows[dataGridView_0.RowCount - 1].DefaultCellStyle.BackColor = System.Drawing.Color.Gainsboro;
	}
	public void method_39(DataGridView dataGridView_0, string string_20, System.DateTime dateTime_2, int int_26, ref int int_27, ref int int_28, ref int int_29)
	{
		System.DateTime d = System.Convert.ToDateTime(dateTime_2.ToString("yyyy/MM/dd"));
		int num = 0;
		int num2 = 0;
		int num3 = 0;
		int num4 = 0;
		int num5 = 0;
		int num6 = 0;
		string text = string.Empty;
		try
		{
			text = "select EventDateTime, VehicleType from tblEvent " + string_20 + " order by EventDateTime";
			DataTable table = this.iconnection_0.GetTable(text);
			if (table != null)
			{
				int num7 = 1;
				foreach (DataRow dataRow in table.Rows)
				{
					System.DateTime dateTime = System.Convert.ToDateTime(System.Convert.ToDateTime(dataRow["EventDateTime"].ToString()).ToString("yyyy/MM/dd"));
					if (d != dateTime)
					{
						num4 += num;
						num5 += num2;
						num6 += num3;
						num = 0;
						num2 = 0;
						num7++;
						d = dateTime;
					}
					int num8 = 0;
					string a = dataRow["VehicleType"].ToString();
					if (a != string.Empty)
					{
						num8 = (int)System.Convert.ToInt16(dataRow["VehicleType"].ToString());
					}
					if (num8 == 2)
					{
						num2++;
					}
					else
					{
						num++;
					}
					num3 = num + num2;
				}
				if (num3 > 0)
				{
					num4 += num;
					num5 += num2;
					num6 += num3;
				}
				table.Dispose();
			}
		}
		catch (System.Exception ex)
		{
			MessageBox.Show("Error while loading and diplay bang tblEvent: " + ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			SystemConfiguration.ilog_0.Error(ex);
		}
		dataGridView_0.Rows.Add(new object[]
		{
			int_26,
			"Tháng " + int_26,
			num5,
			num4,
			num6
		});
		int_27 += num4;
		int_28 += num5;
		int_29 += num6;
	}
}
